Repository navigation
fix(search-events): List tags, not feature flags, for error and issue event searches - #2172
sentry-junior[bot] wants to merge 1 commit into
Conversation
… event searches The issue event and errors-dataset field lookups called the org tags endpoint with useFlagsBackend=1. Sentry then reads the flags backend and returns feature flag keys instead of tags (organization_tags.py), so custom tags such as sessionId never reached the embedded agent. The agent, told that unlisted tags make queries fail, removed valid filters from the query. Drop the flag from both lookups, remove the now-unused listTags option, and fix the docs that recommended it.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Another report of this pattern: user feedback MCP-SERVER-GQM (2026-11-16, This time the agent didn't drop the valid built-in tags Evidence (sentry/mcp-server spans; there was no
Why those filters can't match: in getsentry/sentry, Does this PR cover it? Mostly. With real tags in the list, |
|
Another report of this pattern: user feedback MCP-SERVER-GR2 (2026-11-17, This time the agent couldn't map natural language to a project's custom tag. The project tags errors with Evidence (sentry/mcp-server spans, no
Does this PR cover it? Yes, as far as I can tell: with Required checks pass and the pattern now has 4 reports, so I'm marking this ready for review. |
|
Another report of this pattern: user feedback MCP-SERVER-GS4 (2026-11-18, Same symptom as GNJ: a valid custom tag filter was dropped silently, and the tool returned unfiltered events. Evidence (sentry/mcp-server spans; no
Does this PR cover it? Yes. Without Required checks pass and the pattern has 5 reports, so I'm marking this ready for review and requesting the code owners (@getsentry/OCPO). |
|
Another report of this pattern: user feedback MCP-SERVER-GT9 (2026-11-20, The agent dropped a built-in error tag this time, Evidence (sentry/mcp-server spans; no
This PR's removal of |
|
Another report of this pattern: user feedback MCP-SERVER-GTH (2026-11-21, The caller filtered by a project's custom tag Evidence (sentry/mcp-server, no
This PR fixes the tag lookup, so |
The embedded agents behind
search_issue_eventsandsearch_errorscheck which tags exist before they build a query. Both lookups call/organizations/{org}/tags/withuseFlagsBackend=1. With that flag, Sentry reads the flags backend and returns feature flag keys instead of tags. Seeorganization_tags.py: the param is documented as "query feature flags instead of tags", and the code usesbackend = tagstore.flag_backend. In the traces, the Snuba query groupsBY flags_key.So the agent never sees a project's custom tags. Its prompt says that unlisted tags make queries fail, so it removes valid filters. The user feedback MCP-SERVER-GNJ shows this.
search_issue_eventsgotenvironment:PROD sessionId:<id>, and the agent's explanation said: "Removed sessionId because it is not an available tag for this issue's project".executedSearchranenvironment:PRODonly and returned unrelated events, and those events still carriedsessionIdtags. MCP-SERVER-GJX (an explicit custom tag filter dropped bysearch_issue_events) has the same symptom.How widespread: over the last 30 days, about 490k of roughly 500k sampled
issueEventFieldsexecutions returned exactly 34 entries. 34 is the size of the built-inISSUE_EVENT_TAGSlist, so these runs had zero project-specific tags. Counts above 34 show up only for orgs that have feature flags.Changes
useFlagsBackend: truefromcreateIssueEventFieldsTool(search-issue-events) and from the errors branch offetchCustomAttributes(search-events).useFlagsBackendoption fromSentryApiService.listTags.docs/contributing/search-events-api-patterns.md, which recommended the flag "for latest features".Tests
New regression tests in both places mock the tags endpoint. With
useFlagsBackend=1the mock returns[], and without it the mock returnssessionId. Both tests failed before this change and pass after it.pnpm run tscpasses for mcp-core, and so does the full mcp-core vitest suite (2247 passed).Not in this PR
search_issue_eventssends noprojectto the tags lookup unless the caller passesprojectSlug, so tags come from every project the caller can access. That still works, but it's noisier.search_errorswithissue:<numeric id>got a 400, whilevalidateSearchreported a pass. Tracked in search_errors: numericissue:IDs fail with 400 although validateSearch says the query passed #2173.via Sentry.
--
View Session [Sentry]